﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Administrator/AdminMaster.Master" AutoEventWireup="true" CodeBehind="ManagePatients.aspx.cs" Inherits="MyHealthOnline.Administrators.ManagePatients" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <asp:UpdatePanel ID="updPatients" runat="server" ChildrenAsTriggers="true" UpdateMode="Conditional">
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="grdPatients" EventName="RowCommand" />
            <asp:AsyncPostBackTrigger ControlID="grdPatients" EventName="RowUpdating" />
        </Triggers>
        <ContentTemplate>
            <asp:GridView id="grdPatients" runat="server" AllowPaging="True" 
                DataKeyNames="Id" CssClass="grdExtraCols"
                AutoGenerateColumns="False" CellPadding="4" ShowFooter="True"
                DataSourceID="patientsObjectDataSource" ForeColor="#333333" 
                GridLines="None" onrowcommand="grdPatients_RowCommand" 
                onrowupdating="grdPatients_RowUpdating" >
                <AlternatingRowStyle BackColor="White" />
                <Columns>
                    <asp:TemplateField ShowHeader="False">
                        <EditItemTemplate>
                            <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="false" 
                                CommandArgument="<%# Container.DataItemIndex %>"
                                CommandName="Update" Text="Update"></asp:LinkButton>
                            &nbsp;<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False"
                                CommandArgument="<%# Container.DataItemIndex %>" 
                                CommandName="Cancel" Text="Cancel"></asp:LinkButton>
                        </EditItemTemplate>
                        <FooterTemplate>
                            <asp:LinkButton ID="lnkAddNew" runat="server" CommandName="Add" 
                                CommandArgument="<%# Container.DataItemIndex %>"
                                ForeColor="White">Add</asp:LinkButton>
                        </FooterTemplate>
                        <ItemTemplate>
                            <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" 
                                CommandName="Edit" CommandArgument="<%# Container.DataItemIndex %>"
                                Text="Edit"></asp:LinkButton>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:CommandField ShowDeleteButton="True"></asp:CommandField>
                    <asp:TemplateField HeaderText="Name" SortExpression="Name">
                        <EditItemTemplate>
                            <div class="footerText">
                                <asp:TextBox ID="txtName" runat="server" Text='<%# Bind("Name") %>'></asp:TextBox>
                            </div>
                        </EditItemTemplate>
                        <FooterTemplate>
                            <div class="footerText">
                                <asp:TextBox ID="txtNewName" runat="server" Text='<%# Bind("Name") %>'></asp:TextBox>
                            </div>
                        </FooterTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label1" runat="server" Text='<%# Bind("Name") %>'></asp:Label>
                            </div>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Address" SortExpression="Address">
                        <EditItemTemplate>
                            <div class="footerText">
                                <asp:TextBox ID="txtAddress" runat="server" Text='<%# Bind("Address") %>'></asp:TextBox>
                            </div>
                        </EditItemTemplate>
                        <FooterTemplate>
                            <div class="footerText">
                                <asp:TextBox ID="txtNewAddress" runat="server" Text='<%# Bind("Address") %>'></asp:TextBox>
                            </div>
                        </FooterTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label2" runat="server" Text='<%# Bind("Address") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Birthday" SortExpression="Birthday">
                        <EditItemTemplate>
                            <div class="footerText">
                                <asp:TextBox ID="txtBirthday" runat="server" Text='<%# Bind("Birthday") %>'></asp:TextBox>
                                <asp:CalendarExtender ID="calBirthdayExtender" runat="server" TargetControlID="txtBirthday"></asp:CalendarExtender>
                            </div>
                        </EditItemTemplate>
                        <FooterTemplate>
                            <div class="footerText">
                                <asp:TextBox ID="txtNewBirthday" runat="server" Text='<%# Bind("Birthday") %>'></asp:TextBox>
                                <asp:CalendarExtender ID="calNewBirthdayExtender" runat="server" TargetControlID="txtNewBirthday"></asp:CalendarExtender>
                            </div>
                        </FooterTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label3" runat="server" Text='<%# Bind("Birthday") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="City" SortExpression="City">
                        <EditItemTemplate>
                            <div class="footerText">
                                <asp:TextBox ID="txtCity" runat="server" Text='<%# Bind("City") %>'></asp:TextBox>
                            </div>
                        </EditItemTemplate>
                        <FooterTemplate>
                            <div class="footerText">
                                <asp:TextBox ID="txtNewCity" runat="server" Text='<%# Bind("City") %>'></asp:TextBox>
                            </div>
                        </FooterTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label4" runat="server" Text='<%# Bind("City") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Country" SortExpression="Country">
                        <EditItemTemplate>
                            <div class="footerText">
                                <asp:TextBox ID="txtCountry" runat="server" Text='<%# Bind("Country") %>'></asp:TextBox>
                            </div>
                        </EditItemTemplate>
                        <FooterTemplate>
                            <div class="footerText">
                                <asp:TextBox ID="txtNewCountry" runat="server" Text='<%# Bind("Country") %>'></asp:TextBox>
                            </div>
                        </FooterTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label5" runat="server" Text='<%# Bind("Country") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Email" SortExpression="Email">
                        <EditItemTemplate>
                            <div class="footerText">
                                <asp:TextBox ID="txtEmail" runat="server" Text='<%# Bind("Email") %>'></asp:TextBox>
                            </div>
                        </EditItemTemplate>
                        <FooterTemplate>
                            <div class="footerText">
                                <asp:TextBox ID="txtNewEmail" runat="server" Text='<%# Bind("Email") %>'></asp:TextBox>
                            </div>
                        </FooterTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label6" runat="server" Text='<%# Bind("Email") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Number" SortExpression="Number">
                        <EditItemTemplate>
                            <div class="footerText">
                                <asp:TextBox ID="txtNumber" runat="server" Text='<%# Bind("Number") %>'></asp:TextBox>
                            </div>
                        </EditItemTemplate>
                        <FooterTemplate>
                            <div class="footerText">
                                <asp:TextBox ID="txtNewNumber" runat="server" Text='<%# Bind("Number") %>'></asp:TextBox>
                            </div>
                        </FooterTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label7" runat="server" Text='<%# Bind("Number") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Password" SortExpression="Password">
                        <EditItemTemplate>
                            <div class="footerText">
                                <asp:TextBox ID="txtPassword" runat="server" Text='<%# Bind("Password") %>' 
                                TextMode="Password"></asp:TextBox>
                            </div>
                        </EditItemTemplate>
                        <FooterTemplate>
                            <div class="footerText">
                                <asp:TextBox ID="txtNewPassword" runat="server" TextMode="Password" Text='<%# Bind("Password") %>'></asp:TextBox>
                            </div>
                        </FooterTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label8" runat="server" Text='<%# Bind("Password") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Phone" SortExpression="Phone">
                        <EditItemTemplate>
                            <div class="footerText">
                                <asp:TextBox ID="txtPhone" runat="server" Text='<%# Bind("Phone") %>'></asp:TextBox>
                            </div>
                        </EditItemTemplate>
                        <FooterTemplate>
                            <div class="footerText">
                                <asp:TextBox ID="txtNewPhone" runat="server" Text='<%# Bind("Phone") %>'></asp:TextBox>
                            </div>
                        </FooterTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label9" runat="server" Text='<%# Bind("Phone") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Sex" SortExpression="Sex">
                        <EditItemTemplate>
                            <div class="footerText">
                                <asp:TextBox ID="txtSex" runat="server" Text='<%# Bind("Sex") %>'></asp:TextBox>
                            </div>
                        </EditItemTemplate>
                        <FooterTemplate>
                            <div class="footerText">
                                <asp:TextBox ID="txtNewSex" runat="server" Text='<%# Bind("Sex") %>'></asp:TextBox>
                            </div>
                        </FooterTemplate>
                        <ItemTemplate>
                            <asp:Label ID="Label10" runat="server" Text='<%# Bind("Sex") %>'></asp:Label>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
                <EditRowStyle BackColor="#7C6F57" />
                <FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
                <HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
                <PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
                <RowStyle BackColor="#E3EAEB" />
                <SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
                <sortedascendingcellstyle backcolor="#F8FAFA" />
                <sortedascendingheaderstyle backcolor="#246B61" />
                <sorteddescendingcellstyle backcolor="#D4DFE1" />
                <sorteddescendingheaderstyle backcolor="#15524A" />
                <sortedascendingcellstyle backcolor="#F8FAFA" />
                <sortedascendingheaderstyle backcolor="#246B61" />
                <sorteddescendingcellstyle backcolor="#D4DFE1" />
                <sorteddescendingheaderstyle backcolor="#15524A" />
                <sortedascendingcellstyle backcolor="#F8FAFA" />
                <sortedascendingheaderstyle backcolor="#246B61" />
                <sorteddescendingcellstyle backcolor="#D4DFE1" />
                <sorteddescendingheaderstyle backcolor="#15524A" />
                <sortedascendingcellstyle backcolor="#F8FAFA" />
                <sortedascendingheaderstyle backcolor="#246B61" />
                <sorteddescendingcellstyle backcolor="#D4DFE1" />
                <sorteddescendingheaderstyle backcolor="#15524A" />
                <sortedascendingcellstyle backcolor="#F8FAFA" />
                <sortedascendingheaderstyle backcolor="#246B61" />
                <sorteddescendingcellstyle backcolor="#D4DFE1" />
                <sorteddescendingheaderstyle backcolor="#15524A" />
                <sortedascendingcellstyle backcolor="#F8FAFA" />
                <sortedascendingheaderstyle backcolor="#246B61" />
                <sorteddescendingcellstyle backcolor="#D4DFE1" />
                <sorteddescendingheaderstyle backcolor="#15524A" />
                <sortedascendingcellstyle backcolor="#F8FAFA" />
                <sortedascendingheaderstyle backcolor="#246B61" />
                <sorteddescendingcellstyle backcolor="#D4DFE1" />
                <sorteddescendingheaderstyle backcolor="#15524A" />
            </asp:GridView>
            <asp:ObjectDataSource ID="patientsObjectDataSource" runat="server" 
                SelectMethod="GetPatients" 
                TypeName="MyHealthOnline.Business.PatientBusiness" 
        DeleteMethod="DeletePatient" UpdateMethod="UpdatePatient">
                <DeleteParameters>
                    <asp:Parameter Name="patientId" Type="Int32" />
                </DeleteParameters>
                <UpdateParameters>
                    <asp:Parameter Name="id" Type="Int32" />
                    <asp:Parameter Name="name" Type="String" />
                    <asp:Parameter Name="password" Type="String" />
                    <asp:Parameter Name="number" Type="String" />
                    <asp:Parameter Name="email" Type="String" />
                    <asp:Parameter Name="address" Type="String" />
                    <asp:Parameter Name="city" Type="String" />
                    <asp:Parameter Name="country" Type="String" />
                    <asp:Parameter Name="phone" Type="String" />
                    <asp:Parameter Name="birthday" Type="String" />
                    <asp:Parameter Name="sex" Type="String" />
                </UpdateParameters>
            </asp:ObjectDataSource>
            <br />
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
